////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   REMARK
// AUTHOR           :   Ric Yik 
// DATE CREATE      :   2006/01/05
// DESCRIPTION      :   a SEARCH FORM file for the function, REMARK
//                  :   
//                  :   
//                  :   
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// 2006/01/05   Ric Yik         1.0                 source is generated.
//
//
//
////////////////////////////////////////////////////////////////////////////////

package com.erp.app.setup.remark.web;

import java.util.Iterator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.erp.app.common.ProjectConstants;
import com.erp.app.common.query.BeanQuery;
import com.erp.app.setup.codeSetup.pk.CodeHdrPk;
import com.erp.framework.controller.form.SimpleSearchStyleForm;
import com.erp.framework.util.logger.Logger;

/**
* <p>A <strong>SearchForm</strong> is a JavaBean which provides property
* getter and setter methods for all of the bean properties, and implements
* <code>Serializable</code>, as required by the JavaBean specification
* The main purpose for this bean is to get the user search criteria input
* from the web browsers.
*
* @author          Ric Yik 
* @version 1.0     2006/01/05
* @since           FrameWork 1.0
*
*/

// Note:
// Currently only generates the first 5 fields of a table
// (excluding the COMPANY_CODE field).
// However, this number can be set in GenConstants.NO_CRITERIA

public class RemarkSearchForm extends SimpleSearchStyleForm {

	//Searching Criteria Attributes (DB Table Name: T_REMARK_HDR)
	private String srchCompanyCode;                  //DB Column Name: COMPANY_CODE
	private String srchStatus;                       //DB Column Name: STATUS
	private String srchRemarkMasterCodeFr;           //DB Column Name: REMARK_MASTER_CODE
	private String srchRemarkMasterCodeTo;           //DB Column Name: REMARK_MASTER_CODE
	private String srchRemarkMasterDescFr;           //DB Column Name: REMARK_MASTER_DESC
	private String srchRemarkMasterDescTo;           //DB Column Name: REMARK_MASTER_DESC

	private String editRemarkMasterCode;

	/**
	* Validate the properties that have been set for this non-HTTP request,
	* and return an <code>ActionErrors</code> object that encapsulates any
	* validation errors that have been found.  If no errors are found, return
	* <code>null</code> or an <code>ActionErrors</code> object with no
	* recorded error messages.
	* <p>
	* The default implementation attempts to forward to the HTTP version of
	* this method.
	*
	* @param      the action errors array
	* @author     Ric Yik 
	* @since      FrameWork 1.0
	*/
	public void validateSearch(ActionErrors errors) {

		/*
		if (CommonUtil.isEmpty(srchIssueDate)) {
			ActionErrorUtil.addErrorForGeneralFieldBlank(errors, "Issue Date");
		} else {
			if (!CommonUtil.isValidDate(srchIssueDate)) {
				ActionErrorUtil.addErrorForInvalidDate(errors, "Issue Date");
			}
		}
		*/
	}

	/**
	* Validate the properties that have been set for this non-HTTP request,
	* and return an <code>ActionErrors</code> object that encapsulates any
	* validation errors that have been found.  If no errors are found, return
	* <code>null</code> or an <code>ActionErrors</code> object with no
	* recorded error messages.
	* <p>
	* The default implementation attempts to forward to the HTTP version of
	* this method.
	*
	* @param      mapping      the action mapping
	* @param      formIn       the action form
	* @param      request      the http request
	* @param      response     the http response
	* @param      errors       the action errors array
	* @author     Ric Yik 
	* @since      FrameWork 1.0
	*/
	public void moreValidateSearch(ActionMapping mapping, ActionForm formIn,
		HttpServletRequest request, HttpServletResponse response, ActionErrors errors) {

		HttpSession session = request.getSession(false);

		try {

		} catch (Exception e) {
			Logger.logExceptions(this, e);
		}
	}

	/**
	* Converts to a string representing the data in this object.
	* A new <code>String</code> object is allocated and initialized to 
	* contain the character sequence currently represented by this 
	* object. This <code>String</code> is then returned. Subsequent 
	* changes to this object do not affect the contents of the 
	* <code>String</code>. 
	*
	* @return     a string representation of the object.
	* @see        java.lang.Object#toString()
	* @author     Ric Yik 
	* @since      FrameWork 1.0
	*/
	public String toString() {
		String pkStr = "PK: {srchRemarkMasterCodeFr = " + this.srchRemarkMasterCodeFr
			+ "\n, srchRemarkMasterCodeTo = " + this.srchRemarkMasterCodeTo + "}\n";

		String colStr = "COL: {srchRemarkMasterDescFr = " + this.srchRemarkMasterDescFr
			+ "\n, srchRemarkMasterDescTo = " + this.srchRemarkMasterDescTo + "}\n";

		String mandatoryStr = "{srchCompanyCode = " + this.srchCompanyCode
			+ "\n, srchStatus = " + this.srchStatus
			+ "}\n";

		String editStr = "{editRemarkNo = " + this.editRemarkMasterCode + "}";

		return "toString() is:\n" + mandatoryStr + pkStr + colStr + editStr;
	}

	////////////////////////////////////////////////////////////////////////////////
	//Generated Accessors (get/set methods) for searching criterias
	////////////////////////////////////////////////////////////////////////////////

	public String getSrchCompanyCode() {
		return this.srchCompanyCode;
	}

	public String getSrchStatus() {
		return this.srchStatus;
	}

	public String getSrchRemarkMasterCodeFr() {
		return this.srchRemarkMasterCodeFr;
	}

	public String getSrchRemarkMasterCodeTo() {
		return this.srchRemarkMasterCodeTo;
	}

	public String getSrchRemarkMasterDescFr() {
		return this.srchRemarkMasterDescFr;
	}

	public String getSrchRemarkMasterDescTo() {
		return this.srchRemarkMasterDescTo;
	}

	public String getEditRemarkMasterCode() {
		return this.editRemarkMasterCode;
	}

	public void setSrchCompanyCode(String srchCompanyCode) {
		this.srchCompanyCode = srchCompanyCode;
	}

	public void setSrchStatus(String srchStatus) {
		this.srchStatus = srchStatus;
	}

	public void setSrchRemarkMasterCodeFr(String srchRemarkMasterCodeFr) {
		this.srchRemarkMasterCodeFr = srchRemarkMasterCodeFr;
	}

	public void setSrchRemarkMasterCodeTo(String srchRemarkMasterCodeTo) {
		this.srchRemarkMasterCodeTo = srchRemarkMasterCodeTo;
	}

	public void setSrchRemarkMasterDescFr(String srchRemarkMasterDescFr) {
		this.srchRemarkMasterDescFr = srchRemarkMasterDescFr;
	}

	public void setSrchRemarkMasterDescTo(String srchRemarkMasterDescTo) {
		this.srchRemarkMasterDescTo = srchRemarkMasterDescTo;
	}

	public void setEditRemarkMasterCode(String editRemarkNo) {
		this.editRemarkMasterCode = editRemarkNo;
	}

	public Iterator getSrchStatusValues() {
        return this.getTemplate().getCommonStatusValues();
    }
	
	public Iterator getSrchRemarkMasterCodeFrValues() {
    	return this.getTemplate().getComboboxValues(new BeanQuery("SELECT REMARK_MASTER_CODE, REMARK_MASTER_CODE"
    			+ " FROM T_REMARK_HDR T WHERE T.COMPANY_CODE = '" + this.getSrchCompanyCode() + "'").setModel(this));
    }
	

	////////////////////////////////////////////////////////////////////////////////
	//Other Accessors (get/set methods)
	////////////////////////////////////////////////////////////////////////////////


}
